package com.pro.common.service.sitecontent.fallback;

import com.pro.common.api.enums.EnumSysRole;
import com.pro.common.api.sitecontent.intf.AuthRoleFeignClient;
import com.pro.common.api.sitecontent.model.request.AuthRoleGetPathRequest;
import com.pro.common.api.sitecontent.model.request.AuthRoleGetRouteCodesRequest;
import com.pro.common.service.sitecontent.service.unit.AuthService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Set;

@RestController
@RequestMapping("")
@AllArgsConstructor
public class AuthRouteFeignFallback implements AuthRoleFeignClient {
    private AuthService authService;

    @Override
    public Set<String> getRouteCodes(AuthRoleGetRouteCodesRequest request) {
        EnumSysRole role = request.getRole();
        Set<Long> roleIds = request.getRoleIds();
        return authService.getRouteCodes(role, roleIds);
    }

    @Override
    public Set<String> getPath(AuthRoleGetPathRequest request) {
        EnumSysRole role = request.getRole();
        Set<Long> roleIds = request.getRoleIds();
        return authService.getPath(role, roleIds);
    }
}
